package com.fenxiangtech.mall.web.controller.v1;

import com.fenxiangtech.mall.entity.Theme;
import com.fenxiangtech.mall.service.ThemeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhangjiashun
 */
@Controller("themeControllerV1")
@RequestMapping("/v1/theme")
public class ThemeController {

    @Autowired
    private ThemeService themeService;

    @GetMapping("/list")
    @ResponseBody
    public List<Theme> listSimpleTheme(@RequestParam("ids") String ids) {
        return themeService.listSimpleThemeByIDs(ids);
    }

    @GetMapping("/{id}")
    @ResponseBody
    public Theme getThemeWithProducts(@PathVariable("id") Long id) {
        return themeService.getThemeWithProducts(id);
    }

}
